/*
 * CWinClass.cpp
 *
 *  Created on: 2012-1-26
 *      Author: Administrator
 */

#include "CWindows.h"

/*WNDCLASS* CWinClass::getWndClass(){
	return this->wndclass;
}

void CWinClass::setWndClass(WNDCLASS* wndCls){
	this->wndclass = wndCls;
}*/

unsigned short CWinClass::registerWndClass(){
	this->wndclass.lpfnWndProc = wndProc;
	return ::RegisterClass (this->wndclass);
}

void CWinClass::setWndProc(LRESULT CALLBACK (*wndProc) (HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam)){
	this->wndclass.lpfnWndProc = wndProc;
}

LRESULT CALLBACK CWinClass::wndProc (HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam){
	CWinMsg* msg = msgTypeQueue.get(message);
	if (msg != null){
		msg = clone(msg);
	} else {
		msg = new CWinMsg();
	}
	msg.handle();
}
